#ifndef CLIENT_H
#define CLIENT_H

#include <QThread>
#include <QTcpSocket>

class Client : public QThread
{
    Q_OBJECT
public:
    Client(QTcpSocket * socket, QObject *parent);
    void run();

    QString Read();
    void Write(QString string);
    QHostAddress getPeerAddress();

signals:
    void error(QTcpSocket::SocketError socketError);
    void newToWrite();
    void newToRead();

public slots:
    void ReadFromClient();
    void SendToClient();
    void End();

private:
    int socketDescriptor;
    QTcpSocket *tcpSocket;


    QString writeBuffer;
    QString readBuffer;

public:
    QString NickName;
};

#endif // CLIENT_H
